import { Component, Vue, Watch } from 'vue-property-decorator';
import Menu from './Menu';
import Top from './Top';
import '@/assets/sass/base.sass';
import BaseApi from '@/api/Base';

/**
 *
 * erp主页面
 *
 */

@Component
class Main extends Vue {

  private topActive: string = 'purchase';
  private SubMenu: any = [];
  private MenuList: any = [];

  public render(h: any): any {
    return (
      <el-container direction={'vertical'}>
        <Top on-submenu={ (v: any) => { this.SubMenu = v; } } top-active={this.topActive} top-list={this.MenuList}/>
        <el-container>
          <Menu sub-menu={this.SubMenu}/>
          <el-container>
            <el-main class='main'>
              <router-view></router-view>
            </el-main>
          </el-container>
        </el-container>
      </el-container>
    );
  }

  /**
   * 初始化页面信息
   */
  public async mounted(): Promise<void> {
    this.MenuList = await BaseApi.GetMenu();
  }


}
export default Main;
